<template>
  <div class="box">
      <div class="box1">
        <div>{{ it }}</div>
        <div class="tu">
          <img
            src="../assets/images/QQ图片20220118103851.png"
            alt=""
          />
        </div>
      </div>
      <div class="box2">
        <div class="box3">
          <img src="../assets/images/我的1.png" alt="" />
          <div>我的XX</div>
          <div class="jiantou">
            <van-icon name="arrow" size="20" />
          </div>
        </div>
        <div class="box3">
          <img src="../assets/images/书架.png" alt="" />
          <div>我的XX</div>
          <div class="jiantou">
            <van-icon name="arrow" size="20" />
          </div>
        </div>
        <div class="box3">
          <img src="../assets/images/01.png" alt="" />
          <div>设置</div>
          <div class="jiantou">
            <van-icon name="arrow" size="20" />
          </div>
        </div>
        <div class="box3">
          <img src="../assets/images/笔记.png" alt="" />
          <div>我要反馈</div>
          <div class="jiantou">
            <van-icon name="arrow" size="20" />
          </div>
        </div>
        <div @click="exit" class="tuichu">
          <router-link to="/"> 退出登录 </router-link>
        </div>
      </div>
    </div>
  </div>
</template>
<style lang="less" scoped>
  .box1{
    ul{
      li{ 
        .box2{
          display: flex;
          img{
            width: 100px;
            height: 100px;
          }

        }

      }
    }
  }
</style>
<script>
export default {
  data(){
    return{
      it:null,
      keyy:null
    }
  },
  methods:{
    exit(){
      localStorage.removeItem('token');
    }
  },
  created(){

        // let kda = JSON.parse(localStorage.getItem("token"));
        let cat = localStorage.getItem('token');
        
        this.it = cat


axios({
method:"GET",
url:`http://47.115.51.185/api/verify_code`,

}).then(data=>{
    console.log(data.data.data.key ,"kkk");
    this.keyy = data.data.data.key


})

axios({
method:"post",
url:`http://47.115.51.185/api/register/verify`,

code:"",
key:this.keyy,
phone:"13222222222",
type:"login"


}).then(datas=>{
    console.log(datas);
}),
axios({
method:"GET",
url:`http://47.115.51.185/api/userinfo`,
headers:{
'Authori-zation':'Bearer'+this.keyy
}
}).then(data=>{
    context.commit('loginUser',data.data);
})

        
  },
   beforeRouteEnter(to,from,next){
    //  判断本地储存
     if (typeof localStorage.token == "undefined") {

   // console.log("没有");
    next("/usedDenglu")

  } else {

   // console.log("有");
    next()



  }

   }
}
</script>
<style lang="less" scoped>
.box {
  position: relative;
  .box1 {
    // border-radius: 10px 10px 0 0;
    height: 80px;
    // margin-top: 10px;
    line-height: 45px;
    padding: 5px;
    padding-top: 10px;
     background-image: linear-gradient(to right, #ff9569 0%, #e92758 100%);
    display: flex;
    justify-content: space-around;
    .tu {
      img {
        width: 50px;
        border-radius: 50px;
      }
    }
  }
  .box2 {
    background-color: white;
    position: absolute;
    top: 70px;
    border-radius: 40px 40px 0px 0px;
    width: 100%;
    box-sizing: border-box;
    height: 30px;
    .box3 {
      width: 100%;
      box-sizing: border-box;
      display: flex;
      padding: 40px 10px 10px 10px;
      .jiantou {
        margin-left: auto;
      }
      img {
        width: 20px;
        height: 20px;
        margin-right: 10px;
      }
      line-height: 21px;
      vertical-align: middle;
    }
    .tuichu{
      padding: 20px 10px;
    }
    font-size: 15px;
    font-weight: 500;
  }
}
</style>
